From 407f61647c0b5d30c6d5fa122c26d2a2642a6342 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 6 Sep 2005 16:01:43 +0000 Subject: [PATCH] Add 'floating' suboption to KML writer for pilots. Improve KML doc. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1401 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/README | 21 ++++++++++++++++++--- gpsbabel/kml.c | 12 ++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/gpsbabel/README b/gpsbabel/README index 269aa9dab..ccd7a176f 100644 --- a/gpsbabel/README +++ b/gpsbabel/README @@ -849,9 +849,24 @@ THE FORMATS KML - We have sketchy support for KML, the Keyhole Markup Language. - There are many features in this file format that we don't yet - support, but simple waypoint lists convert fine. + KML, the Keyhole Markup Language, is used by Keyhole and + Google Earth. (Google Earth uses GPSBabel internally for + receiver communications and several file format imports and + exports. There are features in this file format that we + don't support such as camera views, but waypoints, tracks, and + routes work well. + + Additional options: + lines=n (default n=1) Draws lines between points in tracks and + routes when n is non-zero. + points=n (default n=1) Draws placemarks for tracks and routes when + n is non-zero. + line_width=n (default n=6) Width of drawn lines, in pixels. + line_color=n (default=65eeee17) Line colour specified in hex AABBGGRR. + floating=n (default n=0) Altitudes are not clamped to ground when + n is non-zero. This option is more useful to pilots than + to hikers. + GOOGLE diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index 834454eb9..4eb920cda 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -28,9 +28,11 @@ static char *opt_export_lines = NULL; static char *opt_export_points = NULL; static char *opt_line_width = NULL; static char *opt_line_color = NULL; +static char *opt_floating = NULL; static int export_lines; static int export_points; +static int floating; static waypoint *wpt_tmp; @@ -61,6 +63,9 @@ arglist_t kml_args[] = { {"line_color", &opt_line_color, "Line color, specified in hex AABBGGRR", "64eeee17", ARGTYPE_BOOL }, + {"floating", &opt_floating, + "Altitudes are absolute and not clamped to ground", + "0", ARGTYPE_BOOL }, {0, 0, 0, 0, 0} }; @@ -225,6 +230,9 @@ static void kml_output_point(const waypoint *waypointp, const char *style) fprintf(ofd, "\t\n"); fprintf(ofd, "\t %s\n", style); fprintf(ofd, "\t \n"); + if (floating) { + fprintf(ofd, "\t absolute\n"); + } fprintf(ofd, "\t %f,%f,%f\n", pt->longitude, pt->latitude, pt->altitude); fprintf(ofd, "\t \n"); @@ -252,6 +260,9 @@ static void kml_output_tailer(const route_head *header) fprintf(ofd, "\t Path\n"); fprintf(ofd, "\t \n"); fprintf(ofd, "\t \n"); + if (floating) { + fprintf(ofd, "\t absolute\n"); + } fprintf(ofd, "\t \n"); for (i = 0; i < point3d_list_len; ++i) fprintf(ofd, "%f,%f,%f ", @@ -347,6 +358,7 @@ void kml_write(void) // Parse options export_lines = (0 == strcmp("1", opt_export_lines)); export_points = (0 == strcmp("1", opt_export_points)); + floating = (!! strcmp("0", opt_floating)); fprintf(ofd, "\n"); fprintf(ofd, "\n"); -- 2.30.2